<template>
  <div class="parsing-wrapper">
    <div class="parsing-header">
      <div class="testing">{{ `考点：${parsing_data.points}` }}</div>
      <div class="examine" @click="check">
        {{ show ? '收起解析' : '查看解析'
        }}<i :class="show ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
      </div>
    </div>
    <transition name="el-fade-in-linear">
      <div v-if="show">
        <div class="parsing-body">
          <span class="label">正确答案：</span>
          <span class="item">{{ `${parsing_data.answer}` }}</span>
        </div>
        <div class="parsing-footer">
          <span class="key">解析:</span>
          <div v-html="parsing_data.analyze" class="content"></div>
        </div>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  props: {
    // 解析数据
    parsing_data: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  data() {
    return {
      show: true
    }
  },
  methods: {
    check() {
      this.show = !this.show
    }
  }
}
</script>

<style lang="scss" scoped>
.parsing-wrapper {
  margin-top: 24px;
  .parsing-header {
    display: flex;
    .testing {
      font-size: 14px;
      font-weight: 400;
      color: $text-color-secondary;
      margin-right: 20px;
      min-width: 150px;
    }
    .examine {
      font-size: 14px;
      font-weight: 400;
      color: $text-color-secondary;
      cursor: pointer;
      &:hover {
        @include edu-color-auxiliary;
      }
    }
  }
  .parsing-body {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    .label {
      color: $text-color-free;
    }
    .item {
      color: $text-color-import;
    }
  }
  .parsing-footer {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 400;
    color: $text-color-secondary;
    line-height: 24px;
    @include clearfix();
    .key {
      float: left;
    }
    .content ::v-deep * {
      margin: 0;
      padding: 0;
    }
    .content ::v-deep img {
      max-width: 100%;
    }
  }
}
</style>
